package com.whacos.common.listener;

import com.whacos.modules.system.service.SysTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Order(value = 1)
@Component
public class ScheduleJobInitListener implements CommandLineRunner {

    @Autowired
    private SysTaskService sysTaskService;

    @Override
    public void run(String... arg0) throws Exception {
        try {
            sysTaskService.initSchedule();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}